////////////////////////////////////////////////////////////////////////////////
//
//  Copyright (C) 2003-2006 Adobe Macromedia Software LLC and its licensors.
//  All Rights Reserved. The following is Source Code and is subject to all
//  restrictions on such code as contained in the End User License Agreement
//  accompanying this product.
//
////////////////////////////////////////////////////////////////////////////////

package mx.charts
{

import flash.events.Event;
import flash.events.EventDispatcher;
import mx.charts.chartClasses.IChartElement;
import mx.core.IFlexDisplayObject;
import mx.core.IInvalidating;
import mx.skins.ProgrammaticSkin;

/**
 *  A ChartItem represents a single item in a ChartSeries.
 *  In most standard series, there is one ChartItem created
 *  for each item in the series' dataProvider collection.
 *  ChartItems are passed to the instances of a series' itemRenderer
 *  for rendering.  
 *  Most Series types extend ChartItem to contain additional information
 *  specific to the chart type.  
 */
public class ChartItem extends EventDispatcher
{
    include "../core/Version.as";

	//--------------------------------------------------------------------------
	//
	//  Properties
	//
	//--------------------------------------------------------------------------

	/**
	 *  Constructor.
	 *
	 *  @param element The series or element that owns the ChartItem.
	 *
	 *  @param item The item from the series' dataProvider
	 *  that the ChartItem represents.
	 *
	 *  @param index The index of the data from the series' dataProvider
	 *  that the ChartItem represents.
	 */
	public function ChartItem(element:IChartElement = null,
							  item:Object = null, index:uint = 0)
	{
		super();

		this.element = element;
		this.item = item;
		this.index = index;
	}
	
	//--------------------------------------------------------------------------
	//
	//  Properties
	//
	//--------------------------------------------------------------------------

    //----------------------------------
	//  element
    //----------------------------------

	[Inspectable(environment="none")]

	/**
	 *  The series or element that owns the ChartItem.
	 */
	public var element:IChartElement;
	
    //----------------------------------
	//  index
    //----------------------------------

	[Inspectable(environment="none")]

	/**
	 *  The index of the data from the series' dataProvider
	 *  that the ChartItem represents.
	 */
	public var index:int;
	
    //----------------------------------
	//  item
    //----------------------------------
	
	[Inspectable(environment="none")]

	/**
	 *  The item from the series' dataProvider that the ChartItem represents.
	 */
	public var item:Object;
	
    //----------------------------------
	//  itemRenderer
    //----------------------------------

	[Inspectable(environment="none")]

	/**
	 *  The instance of the chart's itemRenderer
	 *  that represents this ChartItem.
	 */
	public var itemRenderer:IFlexDisplayObject;
	
	//--------------------------------------------------------------------------
	//
	//  Methods
	//
	//--------------------------------------------------------------------------

	/**
	 *  Returns a copy of this ChartItem.
	 */
	public function clone():ChartItem
	{		
		var result:ChartItem = new ChartItem(element, item, index);
		result.itemRenderer = itemRenderer;
		return result;
	}
}
	
}
